home *** CD-ROM | disk | FTP | other *** search
/ ZAM 3 / ZAM 3.adf / Source / StandardTxt.AMOS / StandardTxt.amosSourceCode
Encoding:
AMOS Source Code  |  1990-12-11  |  1.4 KB  |  63 lines

  1. ' Limiting your text input program 
  2. '  
  3. '               By 
  4. '
  5. '       Graham Stephenson
  6. '
  7. '       (aka Hawk/Zircon)
  8. '
  9. ' This program will enable you to input a string, without it scrolling onto
  10. ' the line below. It took me several attempts to get this working correctly, 
  11. ' but now I bring you the full version!  
  12. '
  13.  
  14. 'Do : K$=Inkey$ : S=Scancode : Print K$;S : Loop 
  15.  
  16. Screen Open 0,640,200,4,Hires
  17. Flash Off : Paper 0 : Cls 0
  18.  
  19. TXT$="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 "
  20. TXT$=TXT$+"!�$%^&*()_+|-=\,.<>/?;:#@[}]{"
  21.  
  22. TXTX=25 : TXTY=0 : TXTL=20
  23. Home : Print "Please enter your name: ";
  24.  
  25. INP_TEXT:
  26. Locate TXTX,TXTY
  27. ST$=""
  28. Do 
  29.    K$=Inkey$
  30.    S=Scancode
  31.    If S=65
  32.       If Len(ST$)-1=>0
  33.          ST$=Mid$(ST$,1,Len(ST$)-1)
  34.          Locate TXTX,TXTY : Print ST$;" ";
  35.       End If 
  36.    End If 
  37.    If S=68
  38.       Goto DISPLAY_ROUTINE
  39.    End If 
  40.    If K$<>""
  41.       If Len(ST$)+1<=TXTL
  42.          I=Instr(TXT$,K$)
  43.          If I>0
  44.             ST$=ST$+K$
  45.             Locate TXTX,TXTY : Print ST$;
  46.          End If 
  47.       End If 
  48.    End If 
  49. Loop 
  50.  
  51. DISPLAY_ROUTINE:
  52.    Cls 0
  53.    Home 
  54.    Do 
  55.       Print ST$;
  56.    Loop 
  57.  
  58. ' The "Display routine" can just be any series of statements that you
  59. ' want. Hope you find this useful. This routine can be expanded and used 
  60. ' in most circumstances to make your programs look that little more  
  61. ' user friendly...   
  62. '
  63. '                         Graham Stephenson 11-12-92